import { CommonWidgetPropsDefine } from "../../lib/types";
import { defineComponent } from "vue";
import { withFormItem } from "../../lib/theme-default/FormItem";
const PasswordWidget = withFormItem(
  defineComponent({
    name: "PasswordWidget",
    props: CommonWidgetPropsDefine,
    setup(props) {
      const handleChange = (e: any) => {
        const value = e.target.value;
        e.target.value = props.value;
        props.onChange(value);
      };
      return () => {
        return (
          <input
            value={props.value as any}
            type="password"
            onInput={handleChange}
          ></input>
        );
      };
    },
  })
);

export default PasswordWidget;
